﻿function $id(idStr) {
    return document.getElementById(idStr);
}

var act = -1;

function loadCase() {
    act = getParamValue("act");
    var v = nsdis.LoadActAndCases(act).value;
    if (v == null) return;
    $id("caseid").value = v.Rows[0]["CASEID"];
    $id("casetitle").value = v.Rows[0]["TITLE"];
    $id("casecontent").value = v.Rows[0]["CONTENT"];
}

addLoadFuc(function () {
    bindDeps();
    loadCase();
});

///----------绑定组织(单位)-------------------------

function bindDeps() {
    if (act == -1) {
        act = getParamValue("act");
    }
    var dt = nsdis.GetDeps(act).value;
    if (dt == null) return;
    $id("id_sel_org").innerHTML = dt;
}

function processCase() {
    if (act == -1) {
        act = getParamValue("act");
    }
    nsdis.processCase(act);
    window.parent.document.getElementById("right").src = "NotificationPanel.aspx";
}

function cancle() {
    if (act == -1) {
        act = getParamValue("act");
    }
    nsdis.cancle(act);
    window.parent.document.getElementById("right").src = "NotificationPanel.aspx";
}

function Distribute() {
    if (act == -1) {
        act = getParamValue("act");
    }
    var sel = getSelectItem("id_sel_org"); //<option value='{0}'  wfinhertfrom='{1}' wfact='{3}'>{2}</option>
    if (sel == undefined) return;

    nsdis.Distribute(act, sel.value, sel.getAttribute("wfinhertfrom"), sel.getAttribute("wfact"), sel.getAttribute("wfabs"));
    window.parent.document.getElementById("right").src = "NotificationPanel.aspx";
}